<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE HTML>
<html>
	<head>
		
		<title>项目管理系统</title>
		<link rel="stylesheet" type="text/css" href="style/bootstrap.min.css" />
	<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
		<style type="text/css">
body {
	padding-top:70px;
	    	padding-left:70px;
	    	background-image:url(img/ab.png);
	    	
}

.info {
	border: 1px solid #ddd;
	padding: 20px;
	border-top: none;
}

.span5 {
	border-left: 2px solid #ddd;
	padding-left: 20px;
}

.unstyled {
	margin-top: 20px;
}

#address {
	height: 500px;
}

#hide {
	display: none;
}

.unstyled li {
	margin-top: 5px;
}
</style>
	</head>

	<body>
		<%@ include file="top.jsp" %>
	<%@ include file="leftlabel.jsp" %>
				<div class="span9">
					<div class="breadcrumb" style="margin: 0px;">
						<a href="addlinkman.action">联系人</a>
					</div>
					<div class="info">
						<div class="row">
							<div class="span3">
								<a class="btn" style="width: 100px; margin-left: 20px;"
									href="addlinkman.action"><i class="icon-plus"></i>添加联系人</a>
								<ul class="unstyled">
									<c:forEach items="${linkmans }" var="linkman">
										<li>
											<a class="linkman" rel="${linkman.id}"
												href="javascript:void(0)"><i class="icon-list-alt"></i>${linkman.name
												}</a>
										</li>
									</c:forEach>
								</ul>
							</div>
							<div id="address" class="span5">
								<div id="hide">
									<h3>
										<span class="man"></span>
									</h3>

									<address>
										<p>
											<span class="man"></span>
										</p>
										<small >手机</small>一
										<span class="man"></span>
										<br>
										<small>固话</small>一
										<span class="man"></span>
										<br>
										<br>
										<small>邮箱</small>一
										<span class="man"></span>
										<br>
										<small>地址</small>一
										<span class="man"></span>
										<br>
										<br>
										<small>主页</small>一
										<span class="man"></span>
										<br>
										<small>微博</small>一
										<span class="man"></span>
										<br>
										<br>
									</address>

									<div class="page-header">
										记录
									</div>
									<div id="record"></div>
									<a id="allrecord" href="">查看所有记录</a>
									<div style="margin-top: 20px;">
										<a id="edit" class="btn btn-primary" href=""> <i
											class="icon-pencil icon-white"></i> 编辑 </a>
										<a id="delete" class="btn btn-danger"> <i
											class="icon-trash icon-white"></i> 删除 </a>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>

		<div class="modal hide" id="deletemodal">
			<div class="modal-header">
				<a class="close" data-dismiss="modal">×</a>
				<h3>
					友好的信息提示
				</h3>
			</div>
			<div class="modal-body">
				<p>
					真的要删除么？
				</p>
			</div>
			<div class="modal-footer">
				<a id="enterdelete" href="javascript:void(0)" class="btn btn-danger">删除</a>
			</div>
		</div>

	</body>

	<script type="text/javascript">
	$(function() {

		$("#delete").click(function() {
			$("#deletemodal").modal("show");
		});

		$("#enterdelete").click(function() {
			var id = $("#delete").attr("rel");
			window.location.href = "deletelinkman.action?linkman.id=" + id;
		});
		$(".linkman").click(
				function() {
					$.get("showlinkman.action", {
						"linkman.id" : $(this).attr("rel")
					}, function(data) {
						$(".man:eq(0)").text(data.name);
						$(".man:eq(1)").text(data.company);
						$(".man:eq(2)").text(data.mobile);
						$(".man:eq(3)").text(data.phone);
						$(".man:eq(4)").text(data.email);
						$(".man:eq(5)").text(data.address);
						$(".man:eq(6)").text(data.homepage);
						$(".man:eq(7)").text(data.twtter);
						$("#record").text("");
						$(data.records).each(
								function() {
									$(
											"<blockquote> " + this.content
													+ "<small>" + this.username
													+ "发布于" + this.date
													+ "</small></blockquote>")
											.appendTo($("#record"));
								});

						$("#hide").show();
						$("#edit").attr("href",
								"addlinkman.action?linkman.id=" + data.id);
						$("#delete").attr("rel", data.id);
						$("#allrecord").attr("href",
								"linkrecord.action?id=" + data.id);
					});
				});
	});
</script>
</html>
